package com.company;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

public class Tree {
    protected Object value;
    protected List<Tree> children;

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public List<Tree> getChildren() {
        return children;
    }

    public void setChildren(List<Tree> children) {
        this.children = children;
    }

    public Tree getChildByIndex(int index){

        return (children==null||children.size()<index)?null:children.get(index);
    }

    public void addChild(Tree tree){
        children.add(tree);
    }

    public Tree(Object value) {
        this.value = value;
    }

    public Tree() {
    }

    public Tree(Object value, List<Tree> children) {
        this.value = value;
        this.children = children;
    }

    public static void main(String[] args) {
        AtomicInteger a = new AtomicInteger(6);
        int andIncrement = a.getAndIncrement();
        int i = a.addAndGet(7);

    }
}
